function finalStats = hunterStats()%(equipASPD, maxLvl)
	%temporales
	more off;
	clear;
	clc;
	tic()
	global status;
	status = "-";
	equipASPD = 0;
	maxLvl = 99;
	
	SteelCrowSkillLvl= 10;
	bestDmgPerSecond = 0;
	bestBBDmg = 0;
	finalStats = [1, 1, 1, 1];
	bestHitsPerSecond = 0;
	bestDmgPerSecond = 0;
	
	for (agi = 1:99)
		for (dex = 1:99)
			for (luk = 1:99)
				for (int = 1:99)
					currentHitsPerSecond = alterhitsPerSecond(agi, dex, equipASPD);
					currentBBDmg = BBDmg(int, dex, SteelCrowSkillLvl);
					currentDmgPerSecond = currentHitsPerSecond  * currentBBDmg *(luk*0.3)*(1-(luk*0.3)/100)*(luk*0.3);
				
					if(correctStats(agi, dex, luk, int, maxLvl) && not(bestDmgPerSecond > currentDmgPerSecond ));
						bestBBDmg = currentBBDmg;
						bestHitsPerSecond = currentHitsPerSecond;
						bestDmgPerSecond = currentDmgPerSecond;
						finalStats = [agi, dex, luk, int];
					endif
				endfor
			endfor
		endfor
	endfor
	totalTime = toc();
	clc();
	showProgress();%para mostrar progreso
	printStatus(agi, dex, luk, int, finalStats, currentBBDmg, currentHitsPerSecond, currentDmgPerSecond, bestBBDmg, bestHitsPerSecond, bestDmgPerSecond);
					

	printf("\n\n**Se calculo en %g segundos**\n\n", totalTime);
endfunction

function result = correctStats(agi, dex, luk, int, maxLvl)
	a_cost = 0;
	d_cost = 0;
	i_cost = 0;
	l_cost = 0;
	maxStats = 48;
	
	for s = 1:(maxLvl-1)
		maxStats += floor(s/5)+3;
	endfor
	
	for a = 2:agi
		a_cost += floor((a-1) / 10) + 2 ;
	endfor
	
	for d = 2:dex
		d_cost += floor((d-1) / 10) + 2;
	endfor
	
	for l = 2:luk
		l_cost += floor((l-1) / 10) + 2;
	endfor
	
	for i = 2:int
		i_cost += floor((i-1) / 10) + 2;
	endfor
	
	result = (maxStats > a_cost + d_cost + l_cost  + i_cost);
endfunction

function [] = printStatus(agi, dex, luk, int, finalStats, currentBBDmg, currentHitsPerSecond, currentDmgPerSecond, bestBBDmg, bestHitsPerSecond, bestDmgPerSecond)
	printf("\n\n==================================\n")
	printf("\nCurrent Stats:\n ");
	printf(" Agi: %g\n  Dex: %g\n  Luk: %g\n  Int: %g\n", agi, dex, luk, int)
	printf("\nSubStats:\n");
	printf("   Dmg/s: %g\n", currentDmgPerSecond);
	printf("   Crit : %g\n", luk * 0.3);
	printf("   Hits/s: %g\n", currentHitsPerSecond);
	printf("   Blitz Beat Dmg: %g\n", currentBBDmg);	
	printf("\n==================================\n")
	printf("\nBest Stats:\n");
	printf("  Agi: %g\n  Dex: %g\n  Luk: %g\n  Int: %g\n", finalStats)
	printf("\nSubStats:\n");
	printf("   Dmg/s: %g\n", bestDmgPerSecond);
	printf("   Crit : %g\n", finalStats(3) * 0.3);
	printf("   Hits/s: %g\n", bestHitsPerSecond);
	printf("   Blitz Beat Dmg: %g\n", bestBBDmg);
	printf("\n==================================\n")
endfunction

function [] = showProgress()
	global status;
	if(strcmp(status, "-"))
		status = "\\";
	elseif(strcmp(status, "\\"))
		status = "l";
	elseif(strcmp(status, "l"))
		status = "/";
	elseif(strcmp(status, "/"))
		status = "-";
	endif
	printf("\n %s \n", status);
endfunction











